<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../utils.js"></script>
</head>
<body>
    <input type="text" id="search">
    <ul></ul>
    <script>
        // TODO: 点击加上
        function search (resp) {
            console.log(resp)
            var ul = document.querySelector('ul')
            var { s } = resp // 解构赋值

            ul.innerHTML = s.reduce((html, item) => {
                html += `<li>${item}</li>`
                return html
            }, '')
        }
        document.querySelector('#search').onkeyup = function () {
            console.log(this.value)
            utils.jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su', 'search', { wd: this.value })
        }
    </script>
</body>
</html>